#include <stdio.h>
#include <map>

int main(int argc, const char **argv) {
    std::map<std::pair<int, int>, int> a;
    a.emplace(std::make_pair(1,2), 2);
    a.emplace(std::make_pair(1,3), 3);
    a.emplace(std::make_pair(1,4), 4);
    a.emplace(std::make_pair(2,1), 1);
    a.emplace(std::make_pair(2,2), 5);

    auto ret = a.insert(std::make_pair(std::make_pair(1,2), 7));
    if (!ret.second) {
        perror("xxxxxxxxxxxxxxxx");
    }

    for (const auto& elem : a) {
        printf("(%d, %d) => %d\n", elem.first.first, elem.first.second, elem.second);
    }

    perror("xxxx");
    auto result = a.find(std::make_pair(1,3));
    if (result != a.end()) {
        printf("(%d, %d) => %d\n", result->first.first, result->first.second, result->second);
    }
    printf("%d\n", a[std::make_pair(2,2)]);
    return 0;
}
